(function(){
	var _options={
		container:"imgFullZoom",
		item:"ifzItem",
		defaultHW:288
	};
	
	var _plugin_api = {
		main:function(a=_options.container,b = _options.item){
			var ojb = document.getElementById(a);
			var ary = [];
			function pulary(obj){
				if(obj != null){
					var chi = obj.childNodes;
					if(chi){
						for(i=0;i<chi.length;i++){
							if(chi[i].nodeType ===1)pulary(chi);
							if((' ' + chi[i].className + ' ').indexOf(' ' + b + ' ') > -1)ary.push(chi[i]);
						}
					}
				}
			}
			pulary(ojb);
			ary.forEach(function(e){
				var h,w,ih,iw;
				var img = e.childNodes[0];
				h = e.clientHeight;
				w = e.clientWidth;
				e.style.overflow = "hidden";
				e.style.position = "relative";
				var width = e.currentStyle?e.currentStyle['height']:window.getComputedStyle(e)['height'];
				var imgtemp = new Image();
				imgtemp.src = img.src;
				imgtemp.onload = function(){
					ih=this.height;
					iw=this.width;
					if(ih > iw){
						if(h/ih*iw > w )
							img.style = "height:100%;width:"+h/ih*iw+"px;"+"position:absolute;left:-"+(h/ih*iw - w)/2+"px;";
						else
							img.style = "width:100%;height:"+w/iw*ih+"px;"+"position:absolute;top:-"+(w/iw*ih - h)/2+"px;";
					}else{
						if(w/iw*ih > h)
							img.style = "width:100%;height:"+w/iw*ih+"px;"+"position:absolute;top:-"+(w/iw*ih - h)/2+"px;";
						else
							img.style = "height:100%;width:"+h/ih*iw+"px;"+"position:absolute;left:-"+(h/ih*iw - w)/2+"px;";
					}
				}
			});
			return this;
		},
		init:function(a,b){window.onload=function(){_plugin_api.main(a,b);}}
	}
	this.imgFullZoom = _plugin_api;
})();